package com.chief.sink.redis;


import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.functions.sink.RichSinkFunction;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

import java.util.HashSet;
import java.util.Set;

public class RedisSink extends RichSinkFunction<String> {

    JedisCluster jc = null;

    @Override
    public void open(Configuration parameters) throws Exception {
        jc = RedisTest.getJedisCluster();
    }

    @Override
    public void close() throws Exception {
        jc.close();
        jc = null;
    }

    @Override
    public void invoke(String value, Context context) throws Exception {
        jc.sadd("outKey", value);
    }
}
